<?php
session_start();
$title="แสดงรายการห้องพักทั้งหมด";
include ('header-admin.php');

$userID=$_SESSION["HBD_USER"];
$countTopic=0;
if($userID == 1){
?>
<script language="javascript">
	function ConfirmChoice(id){
	answer = confirm("คุณแน่ใจว่าจะลบ ?")
		if (answer !=0)
			location = "doDeleteNews.php?newsID=" + id;
	}
</script>
<style type="text/css" media="all">
@import "css/global.css";
</style>

<script src="js/jquery_.js" type="text/javascript"></script>

<?}?>
<div id="center-block" class="main-content">
<img src="img/house.png"/ id="img-block-content">
<div id="content-title-right" style="margin-top: -14px;">
<!-- 		<h2>แสดงรายการห้องพักทั้งหมด</h2> -->
		<span class="caption">รายการสถานะห้องพักปัจจุบัน</span>
		<span class="right-button">
		<form method="POST" action="currentState.php"><input type="submit" value="เปลี่ยนแปลงห้องพัก" class="button"></form>
				</span>
	</div>

	<hr>
	<table summary="webboard about Datastrucutre learning" id="table">
		<thead>
		<tr class="odd">
			<th scope="col" abbr="reserv_id">หมายเลขห้องพัก</th>
			<th scope="col" abbr="reserv_begin">ขนาดห้อง</th>	
			<th scope="col" abbr="reserv_end">ชนิดห้อง</th>
<!-- 			<th scope="col" abbr="room_id">ราคา</th> -->
			<th scope="col" abbr="customer_id">สถานะ</th>
<!-- 			<th scope="col" abbr="customer_name">จัดการ</th> -->
		</tr>	
		</thead>
		<tbody>
		<?
	$sql="SELECT room_id,roomsize_name,roomtype_name,room_cost,room_status 
   FROM resort,roomsize,roomtype
   WHERE roomsize.roomsize_id = resort.roomsize_id AND roomtype.roomtype_id = resort.roomtype_id ORDER BY resort.room_id ASC";
	$result = mysql_query($sql);
	$status = "";
	while ($rs = mysql_fetch_array($result)){
		$countTopic++;
		if($rs['room_status']==0)$status = 'ว่าง <img src="img/bullet_green.png" style="vertical-align: middle;"></img>';
		if($rs['room_status']==1){
			//$status = 'เข้าพัก<a href="hintDetailCustomer.php?width=375&room_id='.$rs['room_id'].'" class="jTip" id="one'.$rs['room_id'].'" name="รายละเอียดผู้เข้าพัก:"> <img src="img/bullet_red.png" style="vertical-align: middle;"></a></img>';
			/* $status = '<img src="img/bullet_red.png" style="vertical-align: middle;"> <a href="javascript: jQuery.facebox({ajax:&#39;./hintDetailCustomer.php?room_id='.$rs['room_id'].'&#39;});"> <img src="img/user_info.png" style="vertical-align: middle;"></a></img>'; */
			$status = '<img src="img/bullet_red.png" style="vertical-align: middle;"> <a href="hintDetailCustomer.php?room_id='.$rs['room_id'].'" rel="facebox"> <img src="img/user_info.png" style="vertical-align: middle;"></a></img>';
		}
		if($countTopic%2==0)
			echo '<tr class="odd">';
		else
			echo '<tr class="even">';
		echo '<td>' . $rs['room_id'] . '</a>';
//		$rs['ReplyCount']--;
		echo '</td>';
		echo '<td>' . $rs['roomsize_name'] . '</td>';
		echo '<td>' . $rs['roomtype_name'] . '</td>';
/* 		echo '<td>' . $rs['room_cost'] . '</td>'; */
		echo '<td>'.$status.'</td>';
		/*
echo '<td>';
		if($rs['room_status']==1){echo '<a href="checkout.php?room_id=' . $rs['room_id'] . '"><img src="img/icon_checkout.png" /></a></td>&nbsp;';}
*/
	}		
	?>
		</tbody>

	</table>
	</div>

<?
include ('footer.php');
?>